﻿using App.Services;

namespace App.Middles
{
    //需要显示添加到ioc
    public class GreetingMiddleware : IMiddleware
    {
        public GreetingMiddleware(IGreetingService greeting)
        {
            _greeting = greeting;
        }

        private readonly IGreetingService _greeting;

        public Task InvokeAsync(HttpContext context, RequestDelegate next)
            =>context.Response.WriteAsync(_greeting.Greeting(DateTimeOffset.Now));
    }
}
